package com.xc.tjise.TJISE.day06;

import jdk.internal.org.objectweb.asm.tree.analysis.Value;

import java.util.Hashtable;
import java.util.Map;

public class HashtableTestHaXiBiao {
  public static void main(String[] args) {


  Hashtable<String,Integer> hashtable=new Hashtable();// <K,V> key values 键->值
    hashtable.put("A",1);
    hashtable.put("B",2);
    hashtable.put("C",3);
    hashtable.put("A",4);   // 后面的A 将前面的A覆盖掉了 所以 容量三 此时A的值是4
    hashtable.remove("A");  //如果键值不存在 值为null
    System.out.println(hashtable.get("A"));
    System.out.println(hashtable.size());

    System.out.println(hashtable.keySet()); //输出时无序的
    System.out.println(hashtable.containsKey("A"));
    System.out.println(hashtable.containsKey("B"));
    System.out.println();
    System.out.println(hashtable.containsValue(1));
    System.out.println(hashtable.containsValue(2));
    System.out.println(hashtable.containsValue(4));
    System.out.println();
    for (String s : hashtable.keySet()) {
      System.out.println(s);
    }
    for (Integer integer : hashtable.values()) {
      System.out.println(integer);
    }
    System.out.println();
    for (Map.Entry<String, Integer> entry : hashtable.entrySet()) {
      System.out.println(entry.getKey()+"->"+entry.getValue());
    }


    }
 }